﻿<Page x:Class="WpfBrush.Visualbrush"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d"  Background="AliceBlue"
      d:DesignHeight="300" d:DesignWidth="300"
	Title="Visualbrush">
    <Grid>

    <Grid Width="200" Height="90">
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="40" />
      </Grid.RowDefinitions>
      <TextBlock Text="Nero" FontWeight="ExtraBold" FontSize="40" x:Name="tb"  Margin="0,0,0,0" Height="46" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
      <Rectangle Grid.Row="1" HorizontalAlignment="Left"  VerticalAlignment="Top" Height="35" Width="{Binding ElementName=tb,Path=ActualWidth}">
        <Rectangle.Fill>
          <VisualBrush Visual="{Binding ElementName=tb}" Stretch="None" AlignmentY="Bottom" >
            <VisualBrush.RelativeTransform>
              <ScaleTransform  CenterX="0.5" CenterY="0.5" ScaleX="1" ScaleY="-1" />
            </VisualBrush.RelativeTransform>
          </VisualBrush>
        </Rectangle.Fill>
        <Rectangle.OpacityMask>
          <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
            <LinearGradientBrush.GradientStops>
              <GradientStop Offset="0"  Color="#000000"/>
              <GradientStop Offset=".8"  Color="#00000000" />
            </LinearGradientBrush.GradientStops>
          </LinearGradientBrush>
        </Rectangle.OpacityMask>
      </Rectangle>
    </Grid>

    </Grid>
</Page>
